<template>
  <div class="service-details">
    <div class="product-float">
      <div class="product-record-btn" @click="onExchangeRecord">兑换记录</div>
    </div>
    <div class="details__header">
      <div class="details__header-img">
        <img
          class="details__header-img"
          :src="`${imgPrefix}${product.headerImgUrl}`"
        />
      </div>

      <div class="details__header-title">
        <div class="details__header-top">{{ product.name }}</div>
      </div>
    </div>

    <div class="details__content">
      <div class="details__content-box">
        <div class="details__content-text-title">服务细则</div>
        <div
          class="details__content-text-content"
          v-html="product.serviceText"
        ></div>
      </div>
    </div>
  </div>
</template>
<script>
import { onMounted } from 'vue'
import { useRouter } from 'vue-router'
import globalVariables from '@/utils/globalVariables'
export default {
  setup() {
    const router = useRouter()
    const product = globalVariables.currentProdcut

    const onExchangeRecord = () => {
      router.push({ path: '/order' })
    }

    onMounted(() => {
      document.title = '权益详情'
    })

    return {
      product,
      imgPrefix: globalVariables.imgPrefix,
      onExchangeRecord
    }
  }
}
</script>
<style lang="less" scoped="scoped">
.service-details {
  min-height: 100vh;
  background-color: #ececec;
  display: flex;
  flex-direction: column;
  .product-float {
    position: absolute;
    top: 4px;
    right: 0;
    .product-record-btn {
      width: 64px;
      height: 24px;
      background-image: url(../../assets/product-float-btn.png);
      background-size: 140% 100%;

      font-size: 12px;
      font-family: Source Han Sans CN;
      font-weight: 400;
      color: #333333;

      box-sizing: border-box;
      padding: 4px 0 0 10px;
    }
  }
  .details__header {
    .details__header-img {
      width: 375px;
      height: 195px;
    }
    .details__header-title {
      position: relative;
      border-radius: 5px 5px 0px 0px;
      background-color: #fff;
      margin-top: -25px;
      display: flex;
      .details__header-top {
        font-size: 18px;
        font-family: Source Han Sans CN;
        font-weight: bold;
        color: #121212;
        margin: 22px 0 15px 21px;
      }
    }
  }
  .details__content {
    flex: 1;
    background-color: #ececec;

    display: flex;
    flex-direction: column;

    .details__content-box {
      flex: 1;
      margin: 6px 11px 0 11px;
      background-color: #fff;
      border-top-left-radius: 5px;
      border-top-right-radius: 5px;
      .details__content-text-title {
        margin: 13px 0 0 17px;
        font-size: 14px;
        color: #121212;
        font-weight: bold;
      }
      .details__content-text-content {
        font-size: 11px;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #333333;
        line-height: 17px;
        margin: 10px 17px 17px 15px;
        p {
          margin: 0;
          padding: 0;
          margin-bottom: 4px;
        }
      }
    }
  }
}
</style>
